package org.gitos.cloud.cmd.controller;

import java.io.UnsupportedEncodingException;
import java.util.Map;

import org.gitos.cloud.domain.comm.Constant;
import org.gitos.cloud.domain.device.Router;
import org.gitos.cloud.domain.mq.MqMsg;
import org.gitos.cloud.domain.rpc.LedRPC;
import org.gitos.cloud.domain.tcp.Bucket;
import org.gitos.cloud.domain.tcp.DeviceId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;

@Controller
public class LedController extends BaseController {
	private static final Logger log = LoggerFactory
			.getLogger(LedController.class);

	@Reference
	LedRPC ledRPC;

	@Autowired
	private Router router;

	/* 操作类请求 */
	@RequestMapping("/led/cmd")
	@ResponseBody
	public Map<String, Object> cmd(HttpServletRequest request,
			@RequestParam(name = "deviceId") String deviceId,
			@RequestParam(name = "order") String order) {
		return ledRPC.dispatch(deviceId,order) ;
	}

}
